package com.erp.servlet;

import com.erp.service.OrderService;
import com.erp.service.impl.OrderServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;

/**
 * @author zch
 * 审批多选控制器
 */
@WebServlet("/examinemultiple.action")
public class ExamineMultipleServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        OrderService orderService = new OrderServiceImpl();
        String type = req.getParameter("type");
        if(type.equals("9")){
            String[] oids = req.getParameter("oids").split(",");
            System.out.println(Arrays.toString(oids));
            orderService.updateBatch(2,oids);
            req.getRequestDispatcher("examinelist.action").forward(req,resp);
        }else if(type.equals("8")){
            String[] oidss = req.getParameter("oidss").split(",");
            orderService.updateBatch(5,oidss);
            req.getRequestDispatcher("examinelist.action").forward(req,resp);
        }

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
